package com.example.syssoft.controller;

import com.example.syssoft.config.Result;
import com.example.syssoft.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @author happy
 */
@RestController
@RequestMapping(value = "/api/auth")
@Component
@CrossOrigin
@Tag(name = "登录、注册")
public class AuthController {
    @Resource
    private UserService userService;

    public AuthController(UserService adminService) {
        this.userService = adminService;
    }

    @Operation(summary = "登录接口")
    @PostMapping(value = "/login")
    public Result login(String username,String password, HttpServletResponse response) {
        return userService.login(response, username, password);
    }
}
